//
//  BasicUseModel.m
//  MediaShareBB
//
//  Created by Artak Gevorgyan on 5/23/13.
//  Copyright (c) 2013 InnoriseEntertainment. All rights reserved.
//

#import "BasicUseModel.h"
#import "MediaShareBB.h"
#import "MediaShareCommunity.h"
#import "FBMediaShareCommunity.h"
#import "MediaShareCommunityEntity.h"
#import "FBMediaShareCommunityEntity.h"

@interface BasicUseModel () {
	MediaShareBB* _mediaShareBB;
}

@end

@implementation BasicUseModel

-(void) setupUI {
	// Basic steps to setup the UI
}

-(void) useModel {
	_mediaShareBB = [[MediaShareBB alloc] init];
//	[_mediaShareBB addSharingNetwork:MEDIA_SHARE_COMMUNITY_YOUTUBE withCredentials:nil];
//	[_mediaShareBB addSharingNetwork:MEDIA_SHARE_COMMUNITY_GOOGLE_PLUS withCredentials:nil];
}

-(void) onPresentationButtonClick {
	/** 
	 Setup UI to present the avaiable options of the MediaShareBB
	 Examples of available options can be:
		- FB
		- YouTube
		- SkyDrive
		etc.
	 */
	
	// List the available communities and possibly feed the presentation UI
	// with these values.
	NSArray* comm = [_mediaShareBB configuredCommunities];
	for(MediaShareCommunity* s in comm) {
		NSLog(@"Description: %@", [s description]);
	}

	// The presentation view of the supported media share community will be responsible
	// for letting the MediaShareBB know that the communtiy is selected as follows
	[_mediaShareBB communitySelected:[comm lastObject]];
}

#pragma mark - MediaShareBB delegation

// This is where the developer should present the users of the community
-(void) mediaShareCommunitySelected:(MediaShareCommunity*) mediaShareCommunity {
	// List all the entitites registered in this community
	for(MediaShareCommunityEntity* entity in mediaShareCommunity.entities) {
		NSLog(@"Entity ID: %@", [entity entityId]);
		if([entity isKindOfClass:[FBMediaShareCommunityEntity class]]) {
//			FBMediaShareCommunityEntity* fbComm = (FBMediaShareCommunityEntity*) entity;
//			UIImage* img = nil;//[fbComm userImage];
		}
	}
}

-(void) willShareMedia:(NSURL*) media through:(MediaShareCommunity*) descr {
	
}

-(void) updateProgress:(CGFloat) progress forCommunity:(MediaShareCommunity*) descr {

}

-(void) didFinishSharingMedia:(NSURL*) media through:(MediaShareCommunity*) descr {

}

@end
